package com.ff.neuropp.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ff.neuropp.util.DateSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Data
@Entity
@Table(name = "t_ios_user", uniqueConstraints = {@UniqueConstraint(columnNames="id")})
/**
 *  ios用户表
 * @author sun_weiwu
 *
 */
public class IosUser {
	 private static final long serialVersionUID = 1L;

	    @Id
	    @GeneratedValue(strategy = GenerationType.IDENTITY)
	    private int id;
	    
	    @Column(name = "user_id", columnDefinition = "varchar(100) COMMENT '用户Id'")
	    @ApiModelProperty(value = "用户Id")
	    private String userId;

	    @Column(name ="ry_token",columnDefinition = "varchar(255) COMMENT '用户融云token'")
	    @ApiModelProperty(value= "用户融云token")
	    private String ryToken;
	    

	    @Column(name = "user_name", columnDefinition = "varchar(100) COMMENT '用户名称'")
	    @ApiModelProperty(value = "用户名称")
	    private String userName;

	    @Column(name = "email", columnDefinition = "varchar(100) COMMENT '邮箱'")
	    @ApiModelProperty(value = "邮箱")
	    private String email;
	      
	    @Column(name = "password", columnDefinition = "varchar(100) COMMENT '密码'")
	    @ApiModelProperty(value = "密码")
	    private String password;
	    
	    @Column(name = "code", columnDefinition = "varchar(100) COMMENT '验证码'")
	    @ApiModelProperty(value = "验证码")
	    private String code;
	    

	    @Column(name = "expiry_time", columnDefinition = "datetime COMMENT '过期时间'")
	    @ApiModelProperty(value = "过期时间")
	    private Date expiryTime;
	    
	    
	    @Column(name = "open_id", columnDefinition = "varchar(100) COMMENT 'facebook认证唯一标识'")
	    @ApiModelProperty(value = "facebook认证唯一标识")
	    private String openId;
	    
	    @Column(name = "profession", columnDefinition = "varchar(100) COMMENT '职位'")
	    @ApiModelProperty(value = "职位")
	    private String profession;
	    
	    @Column(name = "sign", columnDefinition = "varchar(100) COMMENT '个人签名'")
	    @ApiModelProperty(value = "个人签名")
	    private String sign;
	    
	    
	    @Column(name = "contact_info", columnDefinition = "varchar(100) COMMENT '联系方式'")
	    @ApiModelProperty(value = "联系方式")
	    private String contactInfo;
	    
	    
	    @Column(name = "login_type", columnDefinition = "char(1) COMMENT '登录类型'")
	    @ApiModelProperty(value = "登录类型 1:facebook 2:gmail")
	    private String loginType;
	    
	    @Column(name = "user_type", columnDefinition = "char(1) COMMENT '用户类型'")
	    @ApiModelProperty(value = "用户类型 1:学生 2:老师")
	    private String userType;
	    
	    
	    @Column(name = "head_url", columnDefinition = "varchar(100) COMMENT '用户头像'")
	    @ApiModelProperty(value = "用户头像")
	    private String headUrl;
	    
	    
	    @Transient
	    @ApiModelProperty(value = "正在上的课程list")
	    private  List<Course>  courseList;
	    
	    
	    @Transient
	    @ApiModelProperty(value = "个人履历List")
	    private  List<Resume>  resumeList;
	    

	    //操作时间
	    @Column(updatable = false)
	    @org.hibernate.annotations.CreationTimestamp
	    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	    @JsonSerialize(using = DateSerializer.class)
	    private Date create_date;
	    
	    @Column(name = "update_time", columnDefinition = "datetime COMMENT '更新时间'")
	    private Date updateTime;
	    
}
